package org.ccunix.eshop.service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.ccunix.eshop.dao.CartDAO;
import org.ccunix.eshop.dao.LeavewordDAO;
import org.ccunix.eshop.model.CartModel;
import org.ccunix.eshop.model.LeaveModel;
import org.ccunix.eshop.model.OrdersModel;
public class LeavewordManagerService {
	LeavewordDAO dao = new LeavewordDAO();
	public List<LeaveModel> findLeaveList() {
		try 
		{
			List<LeaveModel> leavewordList = dao.queryLeaveList();
			
			return leavewordList;
		}
		catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}
	public int addLeaveword(int memberId, String context, String title) {
		
		String leaveDate = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm").format(new Date());
		try {
			int row =  dao.insertLeaveword(leaveDate,memberId,context,title);
			return row;
			 
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}
}
